flag_locked: bool,
flag_frozen: bool,
flag_all: bool,
+ flag_exclude: Vec<String>,
}
pub const USAGE: &'static str = "
-h, --help Print this message
-p SPEC, --package SPEC ... Package to build
--all Build all packages in the workspace
+ --exclude SPEC ... Exclude packages from the build
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
--lib Build only this package's library
--bin NAME Build only the specified binary
All packages in the workspace are built if the `--all` flag is supplied. The
`--all` flag may be supplied in the presence of a virtual manifest.
+Note that `--exclude` has to be specified in conjunction with the `--all` flag.
Compilation can be configured via the use of profiles which are configured in
the manifest. The default profile for this command is `dev`, but passing
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
- let spec = if options.flag_all {
- Packages::All
- } else {
- Packages::Packages(&options.flag_package)
+ let spec = match (options.flag_all, &options.flag_exclude) {
+ (true, exclude) if exclude.is_empty() => Packages::All,
+ (true, exclude) => Packages::OptOut(exclude),
+ (false, exclude) if !exclude.is_empty() => panic!("--exclude can only be used together \
+ with --all"),
+ _ => Packages::Packages(&options.flag_package),
};
let opts = CompileOptions {
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum Packages<'a> {
All,
+ OptOut(&'a [String]),
Packages(&'a [String]),
}
.map(PackageIdSpec::from_package_id)
.collect()
}
+ Packages::OptOut(opt_out) => {
+ ws.members()
+ .map(Package::package_id)
+ .map(PackageIdSpec::from_package_id)
+ .filter(|p| opt_out.iter().position(|x| *x == p.name()).is_none())
+ .collect()
+ }
Packages::Packages(packages) => {
packages.iter().map(|p| PackageIdSpec::parse(&p)).collect::<CargoResult<Vec<_>>>()?
}